function [ t ] = evaluate_noise_latency(weight, idx, relevant_idx, target_hover_state, H, dt, model)
%UNTITLED4 Summary of this function goes here
%   Detailed explanation goes here
load('problem.mat','latency');
K = reshape(weight, [length(idx.inputs) length(relevant_idx)+length(idx.inputs)*latency]);
du_que = zeros(length(idx.inputs)*latency,1);
for i=1:latency+1
	x(:,i) = target_hover_state;
end
for t=latency+1:H 
    du_que = circshift(du_que,length(idx.inputs));
    du_que(1:length(idx.inputs)) = x(idx.u_delta_prev,t-1);
    
    dx = compute_dx(target_hover_state, x(:,t-latency));
    delta_u = K*[dx(relevant_idx); du_que];
    noise_F_T = randn(6,1);
    x(:,t+1) = f_heli(x(:,t), delta_u, dt, model, idx, noise_F_T);
    if(norm(x(idx.ned,t+1) - target_hover_state(idx.ned,:)) > 15*length(target_hover_state(idx.ned,:)))
        break;
    end
end

end
